package com.itheima;

import java.util.UUID;
import java.util.function.Supplier;
//【供给型接口 - Supplier】
public class Demo1 {
    //获得一个32位UUID
    public static void main(String[] args) {
        String uuid = getId(() -> UUID.randomUUID().toString()
                .replaceAll("-", ""));
        System.out.println(uuid);

        //获取一个当前系统时间的毫秒值
        String timeId = getId(() -> System.currentTimeMillis() + "");
        System.out.println(timeId);


    }
    public static String getId(Supplier<String> supplier){
        return supplier.get();
    }
}
